import { createRouter, createWebHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    name: 'Index',
    redirect:'/blog',
  },
  {
    path: '/blog',
    name: 'blog',
    component: () => import('@/views/blog/index.vue'),
    children: [
      {
        path: 'article/:id',
        name: 'readArticle',
        component: () => import('@/views/blog/article/index.vue')
      },
      {
        path: 'recently',
        name:'recently',
        component: () => import('@/views/blog/recently/index.vue')
      },
      {
        path: 'categories',
        name:'categories',
        component: () => import('@/views/blog/categories/index.vue'),
        redirect:'/blog/categories/list',
        children: [
          {
            path: 'list',
            name: 'categorieList',
            component: () => import('@/views/blog/categories/list/index.vue')
          },
          {
            path: 'article/:id',
            name: 'categorieArticle',
            component: () => import('@/views/blog/categories/article/index.vue')
          },
        ]
      },
      {
        path: 'tags',
        name:'tags',
        component: () => import('@/views/blog/tags/index.vue'),
        redirect:'/blog/tags/list',
        children: [
          {
            path: 'list',
            name: 'tagList',
            component: () => import('@/views/blog/tags/list/index.vue')
          },
          {
            path: 'article/:id',
            name: 'tagArticle',
            component: () => import('@/views/blog/tags/article/index.vue')
          },
        ]
      },
      {
        path: 'columns',
        name:'columns',
        component: () => import('@/views/blog/columns/index.vue')
      },
      {
        path: 'archives',
        name:'archives',
        component: () => import('@/views/blog/archives/index.vue')
      },
      {
        path: 'friend',
        name:'friend',
        component: () => import('@/views/blog/friend/index.vue')
      },

    ],
    redirect:'/blog/recently',
  },
  {
    path: '/links',
    name: 'links',
    component: () => import('@/views/links/index.vue'),
    children: [
      {
        path: 'about',
        name: 'about',
        component: () => import('@/views/links/about/index.vue')
      }
    ],
    redirect:'/links/about',
  },
  {
    path: '/notes',
    name: 'notes',
    component: () => import('@/views/notes/index.vue')
  },
  {
    path: '/wiki',
    name: 'wiki',
    component: () => import('@/views/wiki/index.vue')
  },
  {
    path: '/chasing',
    name: 'chasing',
    component: () => import('@/views/chasing/index.vue')
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
